home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Start.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  12.9 KB  |  354 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Start.h
  3.  
  4.      Contains:    Start Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1987-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __START__
  18. #define __START__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __FILES__
  25.     #include <Files.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50.  
  51. /*
  52.     Important: When the major version number of kExtensionTableVersion and the value
  53.     returned by gestaltExtensionTableVersion change, it indicates that the Extension
  54.     Table startup mechanism has radically changed and code that doesn't know about
  55.     the new major version must not attempt to use the Extension Table startup
  56.     mechanism.
  57.     
  58.     Changes to the minor version number of kExtensionTableVersion indicate that the
  59.     definition of the ExtensionElement structure has been extended, but the fields
  60.     defined for previous minor versions of kExtensionTableVersion have not changed.
  61. */
  62. enum {
  63.     kExtensionTableVersion        = 0x00000100                    /* current ExtensionTable version (1.0.0) */
  64. };
  65.  
  66. /* ExtensionNotification message codes */
  67. enum {
  68.     extNotificationBeforeFirst    = 0,                            /* Before any extensions have loaded */
  69.     extNotificationAfterLast    = 1,                            /* After all extensions have loaded */
  70.     extNotificationBeforeCurrent = 2,                            /* Before extension at extElementIndex is loaded */
  71.     extNotificationAfterCurrent    = 3                                /* After extension at extElementIndex is loaded */
  72. };
  73.  
  74.  
  75. struct ExtensionElement {
  76.     Str31                             fileName;                    /* The file name */
  77.     long                             parentDirID;                /* the file's parent directory ID */
  78.                                                                 /* and everything after ioNamePtr in the HParamBlockRec.fileParam variant */
  79.     short                             ioVRefNum;                    /* always the real volume reference number (not a drive, default, or working dirID) */
  80.     short                             ioFRefNum;
  81.     SInt8                             ioFVersNum;
  82.     SInt8                             filler1;
  83.     short                             ioFDirIndex;                /* always 0 in table */
  84.     SInt8                             ioFlAttrib;
  85.     SInt8                             ioFlVersNum;
  86.     FInfo                             ioFlFndrInfo;
  87.     long                             ioDirID;
  88.     unsigned short                     ioFlStBlk;
  89.     long                             ioFlLgLen;
  90.     long                             ioFlPyLen;
  91.     unsigned short                     ioFlRStBlk;
  92.     long                             ioFlRLgLen;
  93.     long                             ioFlRPyLen;
  94.     unsigned long                     ioFlCrDat;
  95.     unsigned long                     ioFlMdDat;
  96. };
  97. typedef struct ExtensionElement            ExtensionElement;
  98. typedef ExtensionElement *                ExtensionElementPtr;
  99.  
  100. struct ExtensionTableHeader {
  101.     UInt32                             extTableHeaderSize;            /* size of ExtensionTable header ( equal to offsetof(ExtensionTable, extElements[0]) ) */
  102.     UInt32                             extTableVersion;            /* current ExtensionTable version (same as returned by gestaltExtTableVersion Gestalt selector) */
  103.     UInt32                             extElementIndex;            /* current index into ExtensionElement records (zero-based) */
  104.     UInt32                             extElementSize;                /* size of ExtensionElement */
  105.     UInt32                             extElementCount;            /* number of ExtensionElement records in table (1-based) */
  106. };
  107. typedef struct ExtensionTableHeader        ExtensionTableHeader;
  108.  
  109. struct ExtensionTable {
  110.     ExtensionTableHeader             extTableHeader;                /* the ExtensionTableHeader */
  111.     ExtensionElement                 extElements[1];                /* one element for each extension to load */
  112. };
  113. typedef struct ExtensionTable            ExtensionTable;
  114. typedef ExtensionTable *                ExtensionTablePtr;
  115. typedef ExtensionTablePtr *                ExtensionTableHandle;
  116. typedef CALLBACK_API( void , ExtensionNotificationProcPtr )(UInt32 message, void *param, ExtensionElementPtr extElement);
  117. typedef CALLBACK_API( void , ExtensionTableHandlerProcPtr )(UInt32 message, void *param, ExtensionTableHandle extTableHandle);
  118. typedef STACK_UPP_TYPE(ExtensionNotificationProcPtr)             ExtensionNotificationUPP;
  119. typedef STACK_UPP_TYPE(ExtensionTableHandlerProcPtr)             ExtensionTableHandlerUPP;
  120. #if OPAQUE_UPP_TYPES
  121.     EXTERN_API(ExtensionNotificationUPP)
  122.     NewExtensionNotificationUPP       (ExtensionNotificationProcPtr userRoutine);
  123.  
  124.     EXTERN_API(ExtensionTableHandlerUPP)
  125.     NewExtensionTableHandlerUPP       (ExtensionTableHandlerProcPtr userRoutine);
  126.  
  127.     EXTERN_API(void)
  128.     DisposeExtensionNotificationUPP    (ExtensionNotificationUPP userUPP);
  129.  
  130.     EXTERN_API(void)
  131.     DisposeExtensionTableHandlerUPP    (ExtensionTableHandlerUPP userUPP);
  132.  
  133.     EXTERN_API(void)
  134.     InvokeExtensionNotificationUPP    (UInt32                message,
  135.                                     void *                    param,
  136.                                     ExtensionElementPtr        extElement,
  137.                                     ExtensionNotificationUPP userUPP);
  138.  
  139.     EXTERN_API(void)
  140.     InvokeExtensionTableHandlerUPP    (UInt32                message,
  141.                                     void *                    param,
  142.                                     ExtensionTableHandle    extTableHandle,
  143.                                     ExtensionTableHandlerUPP userUPP);
  144.  
  145. #else
  146.     enum { uppExtensionNotificationProcInfo = 0x00000FC0 };         /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  147.     enum { uppExtensionTableHandlerProcInfo = 0x00000FC0 };         /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  148.     #define NewExtensionNotificationUPP(userRoutine)                 (ExtensionNotificationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtensionNotificationProcInfo, GetCurrentArchitecture())
  149.     #define NewExtensionTableHandlerUPP(userRoutine)                 (ExtensionTableHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtensionTableHandlerProcInfo, GetCurrentArchitecture())
  150.     #define DisposeExtensionNotificationUPP(userUPP)                 DisposeRoutineDescriptor(userUPP)
  151.     #define DisposeExtensionTableHandlerUPP(userUPP)                 DisposeRoutineDescriptor(userUPP)
  152.     #define InvokeExtensionNotificationUPP(message, param, extElement, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppExtensionNotificationProcInfo, (message), (param), (extElement))
  153.     #define InvokeExtensionTableHandlerUPP(message, param, extTableHandle, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppExtensionTableHandlerProcInfo, (message), (param), (extTableHandle))
  154. #endif
  155. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  156. #define NewExtensionNotificationProc(userRoutine)                 NewExtensionNotificationUPP(userRoutine)
  157. #define NewExtensionTableHandlerProc(userRoutine)                 NewExtensionTableHandlerUPP(userRoutine)
  158. #define CallExtensionNotificationProc(userRoutine, message, param, extElement) InvokeExtensionNotificationUPP(message, param, extElement, userRoutine)
  159. #define CallExtensionTableHandlerProc(userRoutine, message, param, extTableHandle) InvokeExtensionTableHandlerUPP(message, param, extTableHandle, userRoutine)
  160.  
  161. union DefStartRec {
  162.     struct {
  163.         SignedByte                         sdExtDevID;
  164.         SignedByte                         sdPartition;
  165.         SignedByte                         sdSlotNum;
  166.         SignedByte                         sdSRsrcID;
  167.     }                                 slotDev;
  168.     struct {
  169.         SignedByte                         sdReserved1;
  170.         SignedByte                         sdReserved2;
  171.         short                             sdRefNum;
  172.     }                                 scsiDev;
  173. };
  174. typedef union DefStartRec                DefStartRec;
  175.  
  176. typedef DefStartRec *                    DefStartPtr;
  177.  
  178. struct DefVideoRec {
  179.     SignedByte                         sdSlot;
  180.     SignedByte                         sdsResource;
  181. };
  182. typedef struct DefVideoRec                DefVideoRec;
  183.  
  184. typedef DefVideoRec *                    DefVideoPtr;
  185.  
  186. struct DefOSRec {
  187.     SignedByte                         sdReserved;
  188.     SignedByte                         sdOSType;
  189. };
  190. typedef struct DefOSRec                    DefOSRec;
  191.  
  192. typedef DefOSRec *                        DefOSPtr;
  193.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  194.                                                                                             #pragma parameter GetDefaultStartup(__A0)
  195.                                                                                             #endif
  196. EXTERN_API( void )
  197. GetDefaultStartup                (DefStartPtr             paramBlock)                            ONEWORDINLINE(0xA07D);
  198.  
  199.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  200.                                                                                             #pragma parameter SetDefaultStartup(__A0)
  201.                                                                                             #endif
  202. EXTERN_API( void )
  203. SetDefaultStartup                (DefStartPtr             paramBlock)                            ONEWORDINLINE(0xA07E);
  204.  
  205.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  206.                                                                                             #pragma parameter GetVideoDefault(__A0)
  207.                                                                                             #endif
  208. EXTERN_API( void )
  209. GetVideoDefault                    (DefVideoPtr             paramBlock)                            ONEWORDINLINE(0xA080);
  210.  
  211.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  212.                                                                                             #pragma parameter SetVideoDefault(__A0)
  213.                                                                                             #endif
  214. EXTERN_API( void )
  215. SetVideoDefault                    (DefVideoPtr             paramBlock)                            ONEWORDINLINE(0xA081);
  216.  
  217.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  218.                                                                                             #pragma parameter GetOSDefault(__A0)
  219.                                                                                             #endif
  220. EXTERN_API( void )
  221. GetOSDefault                    (DefOSPtr                 paramBlock)                            ONEWORDINLINE(0xA084);
  222.  
  223.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  224.                                                                                             #pragma parameter SetOSDefault(__A0)
  225.                                                                                             #endif
  226. EXTERN_API( void )
  227. SetOSDefault                    (DefOSPtr                 paramBlock)                            ONEWORDINLINE(0xA083);
  228.  
  229. EXTERN_API( void )
  230. SetTimeout                        (short                     count);
  231.  
  232. EXTERN_API( void )
  233. GetTimeout                        (short *                count);
  234.  
  235. /*
  236.     InstallExtensionNotificationProc
  237.  
  238.     Installs an ExtensionNotificationUPP.
  239.  
  240.     Parameters:
  241.         extNotificationProc    The ExtensionNotificationUPP to install.
  242.  
  243.     Results:
  244.         noErr        0        The ExtensionNotificationUPP was installed.
  245.         paramErr    -50        This ExtensionNotificationUPP has already been installed.
  246.         memFullErr    -108    Not enough memory to install the ExtensionNotificationUPP.
  247. */
  248. EXTERN_API( OSErr )
  249. InstallExtensionNotificationProc (ExtensionNotificationUPP  extNotificationProc)            TWOWORDINLINE(0x7000, 0xAA7D);
  250.  
  251.  
  252. /*
  253.     RemoveExtensionNotificationProc
  254.  
  255.     Removes an ExtensionNotificationUPP.
  256.     
  257.     Note:    ExtensionNotificationUPPs can't call RemoveExtensionNotificationProc.
  258.  
  259.     Parameters:
  260.         extNotificationProc    The ExtensionNotificationUPP to remove.
  261.  
  262.     Results:
  263.         noErr        0        The ExtensionNotificationUPP was removed.
  264.         paramErr    -50        The ExtensionNotificationUPP was not found, or
  265.                             RemoveExtensionNotificationProc was called from within
  266.                             a ExtensionNotificationUPP (ExtensionNotificationUPPs can't
  267.                             call RemoveExtensionNotificationProc).
  268. */
  269. EXTERN_API( OSErr )
  270. RemoveExtensionNotificationProc    (ExtensionNotificationUPP  extNotificationProc)                TWOWORDINLINE(0x7001, 0xAA7D);
  271.  
  272.  
  273. /*
  274.     InstallExtensionTableHandlerProc
  275.  
  276.     Installs an ExtensionTableHandlerUPP. Control is taken away from the system's default
  277.     handler and the ExtensionTableHandlerUPP is responsible for all changes to the
  278.     ExtensionTable (except for incrementing extElementIndex between extensions). This is
  279.     always the first handler called with extNotificationBeforeFirst and
  280.     extNotificationBeforeCurrent messages and the last handler called with
  281.     extNotificationAfterLast and extNotificationAfterCurrent messages. extElementIndex
  282.     is always incremented immediately after the ExtensionTableHandlerUPP is called with
  283.     the extNotificationAfterCurrent message.
  284.     
  285.     There can only be one ExtensionTableHandler installed.
  286.     
  287.     Warning:    The only safe time to change what ExtensionElement is at
  288.                 ExtensionTable.extElements[extElementIndex] is when your
  289.                 ExtensionTableHandlerUPP is called with the extNotificationAfterCurrent
  290.                 message. You may change the ExtensionTable or the extElementIndex at other
  291.                 times, but you must ensure that the ExtensionElement at
  292.                 ExtensionTable.extElements[extElementIndex] stays the same.
  293.                 
  294.     Note:        If the ExtensionTable or the contents of the folders included in the
  295.                 ExtensionTable are changed after installing an ExtensionTableHandler,
  296.                 RemoveExtensionTableHandlerProc cannot be called.
  297.  
  298.     Parameters:
  299.         extMgrProc            The ExtensionTableHandlerUPP to install.
  300.         extTable            A pointer to an ExtensionTableHandle where
  301.                             InstallExtensionTableHandlerProc will return the current
  302.                             ExtensionTableHandle. You don't own the handle itself and
  303.                             must not dispose of it, but you can change the extElementIndex.
  304.                             the extElementCount, and the ExtensionElements in the table.
  305.  
  306.     Results:
  307.         noErr        0        The ExtensionTableHandlerUPP was installed.
  308.         paramErr    -50        Another ExtensionTableHandlerUPP has already been installed.
  309.         memFullErr    -108    Not enough memory to install the ExtensionTableHandlerUPP.
  310. */
  311. EXTERN_API( OSErr )
  312. InstallExtensionTableHandlerProc (ExtensionTableHandlerUPP  extMgrProc,
  313.                                  ExtensionTableHandle *    extTable)                            TWOWORDINLINE(0x7002, 0xAA7D);
  314.  
  315.  
  316. /*
  317.     RemoveExtensionTableHandlerProc
  318.  
  319.     Remove an ExtensionTableUPP. Control is passed back to the default handler.
  320.  
  321.     Parameters:
  322.         extMgrProc            The ExtensionTableUPP to remove.
  323.  
  324.     Results:
  325.         noErr        0        The ExtensionTableUPP was removed.
  326.         paramErr    -50        This ExtensionTableUPP was not installed,
  327.                             or the ExtensionTable no longer matches the
  328.                             original boot ExtensionTable.
  329. */
  330. EXTERN_API( OSErr )
  331. RemoveExtensionTableHandlerProc    (ExtensionTableHandlerUPP  extMgrProc)                        TWOWORDINLINE(0x7003, 0xAA7D);
  332.  
  333.  
  334. #if PRAGMA_STRUCT_ALIGN
  335.     #pragma options align=reset
  336. #elif PRAGMA_STRUCT_PACKPUSH
  337.     #pragma pack(pop)
  338. #elif PRAGMA_STRUCT_PACK
  339.     #pragma pack()
  340. #endif
  341.  
  342. #ifdef PRAGMA_IMPORT_OFF
  343. #pragma import off
  344. #elif PRAGMA_IMPORT
  345. #pragma import reset
  346. #endif
  347.  
  348. #ifdef __cplusplus
  349. }
  350. #endif
  351.  
  352. #endif /* __START__ */
  353.  
  354.